<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/17 0017
 * Time: 18:57
 */

namespace app\api\controller;


use app\common\model\Distributionrecord;
use app\common\validate\IDMustBePostiveInt;
use app\lib\exception\ParameterException;
use think\Request;

class DadaApi extends BaseController
{
    public function LogisticsTracking(){

        (new IDMustBePostiveInt())->goCheck();

        $param = Request::instance()->param();

        $order = \app\common\model\Order::get($param['id']);
        if(!$order){
            throw new ParameterException([
                'msg' => '该订单不存在'
            ]);
        }
        $distributionrecord = Distributionrecord::where('order_id',$param['id'])->select();

        if($distributionrecord){
            return show(config('status.SUCCESS_STATUS'),'ok',$distributionrecord);
        }else{
            return show(config('status.ERROR_STATUS'),'暂无物流信息','暂无物流信息');
        }
    }

}